#include<bits/stdc++.h>

using namespace std;
int a[10000 + 10], dp[10000 + 10];
int n;

int main() {
    int n;
    cin >> n;
    for (int i = 1; i <= n; i++) {
        cin >> a[i];
        dp[i] = 1;
    }
    for (int i = 2; i <= n; i++) {
        for (int j = 1; j < i; j++) {
            if (a[j] >= a[i])
                dp[i] = max(dp[i], dp[j] + 1);
        }
    }
    sort(dp + 1, dp + n + 1);
    cout << dp[n] << endl;
    return 0;
}